﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPage.Master" AutoEventWireup="true" CodeBehind="ListUserInfo.aspx.cs" Inherits="DrivingCRM.Views.Private.CRM.ListUserInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="banniere" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="nav" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="contenu" runat="server">
    <h2>Informations de l'utilisateur</h2>
    <table class="Table_ItemList">
        <tr>
            <td>Client:</td>
            <td><asp:DropDownList ID="DDL_Client" runat="server" DataSourceID="DS_Client" 
                    DataTextField="CompleteName" DataValueField="Id" AutoPostBack="true"></asp:DropDownList>
                <asp:EntityDataSource ID="DS_Client" runat="server" 
                    ConnectionString="name=Model_DrivingCRMContainer" 
                    DefaultContainerName="Model_DrivingCRMContainer" EntitySetName="UserSet" 
                    EntityTypeFilter="Client">
                </asp:EntityDataSource>
                
            </td>
        </tr>                    
    </table>
    <asp:ListView ID="LV_ListInfos" runat="server" DataKeyNames="Id" 
        DataSourceID="DS_InfosUsers" GroupItemCount="1">
        <ItemTemplate>
            <td runat="server" style="background-color:#DCDCDC;color: #000000;">
                <table class="Table_ItemList">
                    <tr>
                        <td>Prénom:</td>
                        <td><asp:Label ID="FirstnameLabel" runat="server" Text='<%# Eval("Firstname") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nom:</td>
                        <td><asp:Label ID="LastnameLabel" runat="server" Text='<%# Eval("Lastname") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nom d'utilisateur:</td>
                        <td><asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' /></td>
                    </tr>
                    <tr>
                        <td>Date de naissance:</td>
                        <td><asp:Label ID="DateOfBirthLabel" runat="server" Text='<%# Eval("DateOfBirth") %>' /></td>
                    </tr>
                    <tr>
                        <td>Email:</td>
                        <td><asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nombre d'heures total à faire:</td>
                        <td><asp:Label ID="TotalHoursLabel" runat="server" Text='<%# Eval("TotalHours") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nombre d'heures restantes:</td>
                        <td><asp:Label ID="RemainingHoursLabel" runat="server" Text='<%# Eval("RemainingHours") %>' /></td>
                    </tr>
                    <tr>
                        <td>Adresse:</td>
                        <td><asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address.CompleteAddress") %>' /></td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:Label ID="AgencyLabel" runat="server" Text='<%# Eval("Agency.Name") %>' /></td>
                    </tr>
                </table>
            </td>
        </ItemTemplate>
    </asp:ListView>
    <asp:EntityDataSource ID="DS_InfosUsers" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer" 
        DefaultContainerName="Model_DrivingCRMContainer" EntitySetName="UserSet" 
        EntityTypeFilter="Client" Where="it.Id == @IdClient" Include="Address, Agency">
        <WhereParameters>
            <asp:ControlParameter ControlID="DDL_Client" DbType="Guid" Name="IdClient" PropertyName="SelectedValue" />
        </WhereParameters>
    </asp:EntityDataSource>
    
    <br />
    <h2 align="center">Notes</h2>

    <asp:ListView ID="LV_UserMarks" runat="server" DataKeyNames="IdMark" 
        DataSourceID="DS_Marks" GroupItemCount="1">
        <ItemTemplate>
            <td runat="server" style="background-color:#DCDCDC;color: #000000;">
                <table class="Table_ItemList">    
                    <tr>
                        <td>Date de notation:</td>
                        <td><asp:Label ID="MarkingDateLabel" runat="server" Text='<%# Eval("MarkingDate") %>' /></td>
                    </tr>
                    <tr>
                        <td>Note:</td>
                        <td><asp:Label ID="ValueLabel" runat="server" Text='<%# Eval("Value") %>' /></td>
                    </tr>
                    <tr>
                        <td>Evénement:</td>
                        <td><asp:Label ID="EventLabel" runat="server" Text='<%# Eval("Event.Type") %>' /></td>
                    </tr>
                </table>
            </td>
        </ItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        Aucune note en base.</td>
                </tr>
                <%--<tr>
                    <td>
                        <asp:Button ID="B_AddMark" runat="server" Text="Ajouter une note" OnClick="B_AddMark_Click" />
                    </td>
                </tr>--%>
            </table>
        </EmptyDataTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <%--<tr>
                    <td>
                        <asp:Button ID="B_AddMark" runat="server" Text="Ajouter une note" OnClick="B_AddMark_Click" />
                    </td>
                </tr>--%>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" PreviousPageText="Précédent" FirstPageText="Première page" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" NextPageText="Suivant" LastPageText="Dernière page" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
    </asp:ListView>
    <asp:EntityDataSource ID="DS_Marks" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer" 
        DefaultContainerName="Model_DrivingCRMContainer" EnableFlattening="False" 
        EntitySetName="MarkSet" EntityTypeFilter="Mark" where="it.ClientId == @IdClientMark" Include ="Event">
        <WhereParameters>
            <asp:ControlParameter ControlID="DDL_Client" DbType="Guid" Name="IdClientMark" PropertyName="SelectedValue" />
        </WhereParameters> 
    </asp:EntityDataSource>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer" runat="server">
</asp:Content>
